$(document).ready(function() {


	$('footer>div').click(function(){
		//html跳转
		var url = $(this).attr('data-href');
		window.location.href = url;
	})

	/*$('.case-title').each(function(i){
		var h = $(this).height();
		$(this).css({'margin-top':(70 - h) / 2 + 'px'});
	})*/



	$('.return').click(function(){
		window.history.back(-1);
	})

	$('.star-lawyer-item').click(function(){
		var id = $(this).attr('id');

		window.location.href = 'lvshi_detail';
	})





	$('.good_at_list li').click(function(){
		window.location.href = 'article_list';
	})

	$('.wechat').click(function(){
		var url = $(this).find('img').attr('src');
		$('.qrcode').attr('src', url);
		$('.mask,.qrcode').show();
	})

	$('.iconfont-cuowu').click(function(){
		$('.mask,.qrcode').hide();
	})

	$('.filter-item').click(function(){
		$(this).addClass('filter-item-active').siblings('.filter-item').removeClass('filter-item-active');
		
		var text = $(this).html();
		/*var index = $(this).index();
		swiper.params.initialSlide = index;*/
		var w = $(this).width(),index = $(this).index();
		if(index >= 4 && index <= $('.filter-item').length - 4){
			$('.swiper-wrapper').css({'transform': 'translate3d(-'+ w * index +'px, 0px, 0px)'})
		} else if(index > $('.filter-item').length - 4){
			$('.swiper-wrapper').css({'transform': 'translate3d(-'+ w * ($('.filter-item').length - 4) +'px, 0px, 0px)'})
		}
		
		if(text !== '全部'){
			params.expert = text;
		} else {
			params.expert = '';
		}
		params.offset = 1;
		
		
		search();
	})
});

function getQueryString(name) {
    var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i");
    var r = window.location.search.substr(1).match(reg);
    if (r != null) return r[2];
    return null;
}

/** 律师列表跳转 **/
function initLvshiList(){
	$('.lawyer').click(function(){
		var id = $(this).attr('data-id');
		window.location.href = 'lvshi_detail?id='+id;
	});
}

function initCaseList(){
  	$('.case-list li').click(function(){
  		var id = $(this).attr('data-id');
  		window.location.href = 'case_detail?id='+id;
  	})
}

function initGoodAt(){
  	$('.good_at_list li').click(function(){
  	var name=encodeURI($(".lvshi_name").html());
  	 var expert=encodeURI($(this).html());
  		window.location.href = 'article_list2?name='+name+'&expert='+expert;
  	})
}

function initClassCase(){
  	$('.classic_cases').click(function(){
  	  var name=encodeURI($(".lvshi_name").html());
  		window.location.href = 'article_list2?name='+name;
  	})
}
